/**
 * 
 */
package com.maywide.jdp.core.vo;

import com.google.gson.annotations.Expose;


/**
 * @author luoyang
 *
 */
public class Context {
	/**
	 * ID
	 */
	@Expose
	private String id = null;
	
	/**
	 * 帐号
	 */
	@Expose
	private String operatorID = null;
	
	/**
	 * 姓名
	 */
	@Expose
	private String operatorname = null;

	/**
	 * 手机
	 */
	@Expose
	private String mobile = null;

	/**
	 * 电邮
	 */
	@Expose
	private String email = null;
	
	/**
	 * 当前所在的机构
	 */
	@Expose
	private String currentOrganization = null;
	
	/**
	 * 当前机构路径
	 */
	@Expose
	private String orgPath = null;
	
	/**
	 * 所属的机构数组
	 */
	@Expose
	private String[] organizations = null;
	
	/**
	 * 选择的登录机构ID
	 */
	@Expose
	private String loginOrganization = null;
	
	/**
	 * 所属的角色数组
	 */
	@Expose
	private String[] roles = null;
	
	public Context() {
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the operatorID
	 */
	public String getOperatorID() {
		return operatorID;
	}

	/**
	 * @param operatorID the operatorID to set
	 */
	public void setOperatorID(String operatorID) {
		this.operatorID = operatorID;
	}

	/**
	 * @return the operatorname
	 */
	public String getOperatorname() {
		return operatorname;
	}

	/**
	 * @param operatorname the operatorname to set
	 */
	public void setOperatorname(String operatorname) {
		this.operatorname = operatorname;
	}

	/**
	 * @return the mobile
	 */
	public String getMobile() {
		return mobile;
	}

	/**
	 * @param mobile the mobile to set
	 */
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @param currentOrganization the currentOrganization to set
	 */
	public void setCurrentOrganization(String currentOrganization) {
		this.currentOrganization = currentOrganization;
	}

	/**
	 * @return the currentOrganization
	 */
	public String getCurrentOrganization() {
		return currentOrganization;
	}

	/**
	 * @param orgPath the orgPath to set
	 */
	public void setOrgPath(String orgPath) {
		this.orgPath = orgPath;
	}

	/**
	 * @return the orgPath
	 */
	public String getOrgPath() {
		return orgPath;
	}

	/**
	 * @return the organizations
	 */
	public String[] getOrganizations() {
		return organizations;
	}

	/**
	 * @param organizations the organizations to set
	 */
	public void setOrganizations(String[] organizations) {
		this.organizations = organizations;
	}

	/**
	 * @param loginOrganization the loginOrganization to set
	 */
	public void setLoginOrganization(String defaultOrgID) {
		this.loginOrganization = defaultOrgID;
	}

	/**
	 * @return the loginOrganization
	 */
	public String getLoginOrganization() {
		return loginOrganization;
	}

	/**
	 * @return the roles
	 */
	public String[] getRoles() {
		return roles;
	}

	/**
	 * @param roles the roles to set
	 */
	public void setRoles(String[] roles) {
		this.roles = roles;
	}
	
	public String[] getRoleIDs() {
		if (roles == null)
			return null;

		int n = roles.length;
		String[] roleIDs = new String[n];
		for (int i = 0; i < n; i++) {
			String role = roles[i];
			String[] roleArray = role.split(",");
			roleIDs[i] = roleArray[0];
		}
		return roleIDs;
	}
}
